CssJsHtml

vue-echart 点击跳转传参和接收

2019/03/05 17:09 5547 次阅读王梓
★ 打赏
✸ ✸ ✸

1.vue-echart  点击跳转通过路由传参。

<template>
  <div :style="{height: height + 'px'}">
    <IEcharts :option="line_option" :loading="loading" @ready="onReady" @click="onClick"></IEcharts>
  </div>
</template>

    methods: {
      onClick(event, instance, ECharts) {
        let date = new Date(event.name.slice(0, 4) + '/' + event.name.slice(4, 6) + '/' + event.name.slice(6, 8))
        let starttime = date
        let endtime = new Date(date.getTime() + 24 * 60 * 60 * 1000)

        this.$router.push({
          path: "Detail",
          name: "告警详情",
          params: {
            timevalue: [starttime, endtime]
          }
        })
      }
}

2.跳转页面参数接收:

created: function () {
  
if (this.$route.params.timevalue) {
this.timevalue = this.$route.params.timevalue
console.log(this.timevalue)
}
}

 

✸ ✸ ✸

📜 版权声明

本文作者:王梓 | 原文链接:https://www.bthlt.com/note/8789721-CssJsHtmlvue-echart 点击跳转传参和接收

出处:葫芦的运维日志 | 转载请注明出处并保留原文链接

📜 留言板

留言提交后需管理员审核通过才会显示